using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using Gko.Utils;
using Gko.Wpf.Mvvm.Interfaces;

namespace Gko.Wpf.Mvvm
{
	public abstract class WindowViewModelBase : ViewModelBase, IWindowViewModel
	{
		protected WindowViewModelBase()
		{
		}

		public event EventHandler CloseView;

		public virtual void OnViewClosing(CancelEventArgs e)
		{
		}

		public virtual void OnViewClosed()
		{
			this.Dispose();
		}

		public virtual void OnActivated()
		{
		}

		public virtual void OnDeactivated()
		{
		}

		[SubscribeToEvent(typeof(FrameworkElement), "SizeChangedEvent")]
		public virtual void OnSizeChanged(SizeChangedEventArgs eventArgs)
		{
		}

		protected virtual void OnClose()
		{
			this.CloseView.Raise(this);
		}

		public void Close()
		{
			this.OnClose();
		}
	}
}